<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="车辆编码" prop="carId">
<!--        <el-input-->
<!--          v-model="queryParams.carId"-->
<!--          placeholder="请输入车辆编码"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="车牌号" prop="carNo">-->
<!--        <el-input-->
<!--          v-model="queryParams.carNo"-->
<!--          placeholder="请输入车牌号"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="设备号" prop="deviceNo">-->
<!--        <el-input-->
<!--          v-model="queryParams.deviceNo"-->
<!--          placeholder="请输入设备号"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="SIM卡号" prop="simNo">-->
<!--        <el-input-->
<!--          v-model="queryParams.simNo"-->
<!--          placeholder="请输入SIM卡号"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="车辆类型编码" prop="carTypeId">-->
<!--        <el-input-->
<!--          v-model="queryParams.carTypeId"-->
<!--          placeholder="请输入车辆类型编码"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="车辆类型名称" prop="carTypeName">-->
<!--        <el-input-->
<!--          v-model="queryParams.carTypeName"-->
<!--          placeholder="请输入车辆类型名称"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="组编码" prop="groupId">-->
<!--        <el-input-->
<!--          v-model="queryParams.groupId"-->
<!--          placeholder="请输入组编码"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="组名称" prop="groupName">-->
<!--        <el-input-->
<!--          v-model="queryParams.groupName"-->
<!--          placeholder="请输入组名称"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="司机编码" prop="driverId">-->
<!--        <el-input-->
<!--          v-model="queryParams.driverId"-->
<!--          placeholder="请输入司机编码"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="司机姓名" prop="driverName">-->
<!--        <el-input-->
<!--          v-model="queryParams.driverName"-->
<!--          placeholder="请输入司机姓名"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="司机电话" prop="driverTel">-->
<!--        <el-input-->
<!--          v-model="queryParams.driverTel"-->
<!--          placeholder="请输入司机电话"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="发动机号" prop="engineNo">-->
<!--        <el-input-->
<!--          v-model="queryParams.engineNo"-->
<!--          placeholder="请输入发动机号"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="品牌" prop="brand">-->
<!--        <el-input-->
<!--          v-model="queryParams.brand"-->
<!--          placeholder="请输入品牌"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="颜色" prop="colour">-->
<!--        <el-input-->
<!--          v-model="queryParams.colour"-->
<!--          placeholder="请输入颜色"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="限载人数" prop="capacity">-->
<!--        <el-input-->
<!--          v-model="queryParams.capacity"-->
<!--          placeholder="请输入限载人数"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="排量" prop="displacement">-->
<!--        <el-input-->
<!--          v-model="queryParams.displacement"-->
<!--          placeholder="请输入排量"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="里程系数" prop="mileageRatio">-->
<!--        <el-input-->
<!--          v-model="queryParams.mileageRatio"-->
<!--          placeholder="请输入里程系数"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="档案编号" prop="fileNo">-->
<!--        <el-input-->
<!--          v-model="queryParams.fileNo"-->
<!--          placeholder="请输入档案编号"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="车辆识别码" prop="identityNo">-->
<!--        <el-input-->
<!--          v-model="queryParams.identityNo"-->
<!--          placeholder="请输入车辆识别码"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="登记日期" prop="registerDate">-->
<!--        <el-date-picker clearable-->
<!--          v-model="queryParams.registerDate"-->
<!--          type="date"-->
<!--          value-format="yyyy-MM-dd"-->
<!--          placeholder="请选择登记日期">-->
<!--        </el-date-picker>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="购买日期" prop="buyDate">-->
<!--        <el-date-picker clearable-->
<!--          v-model="queryParams.buyDate"-->
<!--          type="date"-->
<!--          value-format="yyyy-MM-dd"-->
<!--          placeholder="请选择购买日期">-->
<!--        </el-date-picker>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="年审日期" prop="annualReviewDate">-->
<!--        <el-date-picker clearable-->
<!--          v-model="queryParams.annualReviewDate"-->
<!--          type="date"-->
<!--          value-format="yyyy-MM-dd"-->
<!--          placeholder="请选择年审日期">-->
<!--        </el-date-picker>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="证件照" prop="certificatePic">-->
<!--        <el-input-->
<!--          v-model="queryParams.certificatePic"-->
<!--          placeholder="请输入证件照"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="图片" prop="pic">-->
<!--        <el-input-->
<!--          v-model="queryParams.pic"-->
<!--          placeholder="请输入图片"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="车主" prop="owner">-->
<!--        <el-input-->
<!--          v-model="queryParams.owner"-->
<!--          placeholder="请输入车主"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="保管人" prop="custodian">-->
<!--        <el-input-->
<!--          v-model="queryParams.custodian"-->
<!--          placeholder="请输入保管人"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="购买地址" prop="buyAddress">-->
<!--        <el-input-->
<!--          v-model="queryParams.buyAddress"-->
<!--          placeholder="请输入购买地址"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="备注" prop="remarks">-->
<!--        <el-input-->
<!--          v-model="queryParams.remarks"-->
<!--          placeholder="请输入备注"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="创建时间" prop="createdTime">-->
<!--        <el-date-picker clearable-->
<!--          v-model="queryParams.createdTime"-->
<!--          type="date"-->
<!--          value-format="yyyy-MM-dd"-->
<!--          placeholder="请选择创建时间">-->
<!--        </el-date-picker>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="配件" prop="parts">-->
<!--        <el-input-->
<!--          v-model="queryParams.parts"-->
<!--          placeholder="请输入配件"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item>-->
        <el-input aria-placeholder="关键字" v-model="searchkeyword"></el-input>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['wx:vehicles:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['wx:vehicles:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['wx:vehicles:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['wx:vehicles:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="vehiclesList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="车辆编码" align="center" prop="carId" />
      <el-table-column label="车牌号" align="center" prop="carNo" />
      <el-table-column label="设备号" align="center" prop="deviceNo" />
      <el-table-column label="SIM卡号" align="center" prop="simNo" />
      <el-table-column label="车辆类型编码" align="center" prop="carTypeId" />
      <el-table-column label="车辆类型名称" align="center" prop="carTypeName" />
      <el-table-column label="组编码" align="center" prop="groupId" />
      <el-table-column label="组名称" align="center" prop="groupName" />
      <el-table-column label="司机编码" align="center" prop="driverId" />
      <el-table-column label="司机姓名" align="center" prop="driverName" />
      <el-table-column label="司机电话" align="center" prop="driverTel" />
      <el-table-column label="发动机号" align="center" prop="engineNo" />
      <el-table-column label="品牌" align="center" prop="brand" />
      <el-table-column label="颜色" align="center" prop="colour" />
      <el-table-column label="限载人数" align="center" prop="capacity" />
      <el-table-column label="排量" align="center" prop="displacement" />
      <el-table-column label="里程系数" align="center" prop="mileageRatio" />
      <el-table-column label="档案编号" align="center" prop="fileNo" />
      <el-table-column label="车辆识别码" align="center" prop="identityNo" />
      <el-table-column label="登记日期" align="center" prop="registerDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.registerDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="购买日期" align="center" prop="buyDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.buyDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="年审日期" align="center" prop="annualReviewDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.annualReviewDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="证件照" align="center" prop="certificatePic" />
      <el-table-column label="图片" align="center" prop="pic" />
      <el-table-column label="车主" align="center" prop="owner" />
      <el-table-column label="保管人" align="center" prop="custodian" />
      <el-table-column label="购买地址" align="center" prop="buyAddress" />
      <el-table-column label="备注" align="center" prop="remarks" />
      <el-table-column label="使用状态" align="center" prop="useStatus" />
      <el-table-column label="状态" align="center" prop="status" />
      <el-table-column label="创建时间" align="center" prop="createdTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createdTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="配件" align="center" prop="parts" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-location"
            @click="toVehiclelog(scope.row.carId)"
            >
            位置
          </el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['wx:vehicles:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['wx:vehicles:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改车辆信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="车辆编码" prop="carId">
          <el-input v-model="form.carId" placeholder="请输入车辆编码" />
        </el-form-item>
        <el-form-item label="车牌号" prop="carNo">
          <el-input v-model="form.carNo" placeholder="请输入车牌号" />
        </el-form-item>
        <el-form-item label="设备号" prop="deviceNo">
          <el-input v-model="form.deviceNo" placeholder="请输入设备号" />
        </el-form-item>
        <el-form-item label="SIM卡号" prop="simNo">
          <el-input v-model="form.simNo" placeholder="请输入SIM卡号" />
        </el-form-item>
        <el-form-item label="车辆类型编码" prop="carTypeId">
          <el-input v-model="form.carTypeId" placeholder="请输入车辆类型编码" />
        </el-form-item>
        <el-form-item label="车辆类型名称" prop="carTypeName">
          <el-input v-model="form.carTypeName" placeholder="请输入车辆类型名称" />
        </el-form-item>
        <el-form-item label="组编码" prop="groupId">
          <el-input v-model="form.groupId" placeholder="请输入组编码" />
        </el-form-item>
        <el-form-item label="组名称" prop="groupName">
          <el-input v-model="form.groupName" placeholder="请输入组名称" />
        </el-form-item>
        <el-form-item label="司机编码" prop="driverId">
          <el-input v-model="form.driverId" placeholder="请输入司机编码" />
        </el-form-item>
        <el-form-item label="司机姓名" prop="driverName">
          <el-input v-model="form.driverName" placeholder="请输入司机姓名" />
        </el-form-item>
        <el-form-item label="司机电话" prop="driverTel">
          <el-input v-model="form.driverTel" placeholder="请输入司机电话" />
        </el-form-item>
        <el-form-item label="发动机号" prop="engineNo">
          <el-input v-model="form.engineNo" placeholder="请输入发动机号" />
        </el-form-item>
        <el-form-item label="品牌" prop="brand">
          <el-input v-model="form.brand" placeholder="请输入品牌" />
        </el-form-item>
        <el-form-item label="颜色" prop="colour">
          <el-input v-model="form.colour" placeholder="请输入颜色" />
        </el-form-item>
        <el-form-item label="限载人数" prop="capacity">
          <el-input v-model="form.capacity" placeholder="请输入限载人数" />
        </el-form-item>
        <el-form-item label="排量" prop="displacement">
          <el-input v-model="form.displacement" placeholder="请输入排量" />
        </el-form-item>
        <el-form-item label="里程系数" prop="mileageRatio">
          <el-input v-model="form.mileageRatio" placeholder="请输入里程系数" />
        </el-form-item>
        <el-form-item label="档案编号" prop="fileNo">
          <el-input v-model="form.fileNo" placeholder="请输入档案编号" />
        </el-form-item>
        <el-form-item label="车辆识别码" prop="identityNo">
          <el-input v-model="form.identityNo" placeholder="请输入车辆识别码" />
        </el-form-item>
        <el-form-item label="登记日期" prop="registerDate">
          <el-date-picker clearable
            v-model="form.registerDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择登记日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="购买日期" prop="buyDate">
          <el-date-picker clearable
            v-model="form.buyDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择购买日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="年审日期" prop="annualReviewDate">
          <el-date-picker clearable
            v-model="form.annualReviewDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择年审日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="证件照" prop="certificatePic">
          <el-input v-model="form.certificatePic" placeholder="请输入证件照" />
        </el-form-item>
        <el-form-item label="图片" prop="pic">
          <el-input v-model="form.pic" placeholder="请输入图片" />
        </el-form-item>
        <el-form-item label="车主" prop="owner">
          <el-input v-model="form.owner" placeholder="请输入车主" />
        </el-form-item>
        <el-form-item label="保管人" prop="custodian">
          <el-input v-model="form.custodian" placeholder="请输入保管人" />
        </el-form-item>
        <el-form-item label="购买地址" prop="buyAddress">
          <el-input v-model="form.buyAddress" placeholder="请输入购买地址" />
        </el-form-item>
        <el-form-item label="备注" prop="remarks">
          <el-input v-model="form.remarks" placeholder="请输入备注" />
        </el-form-item>
        <el-form-item label="创建时间" prop="createdTime">
          <el-date-picker clearable
            v-model="form.createdTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择创建时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="配件" prop="parts">
          <el-input v-model="form.parts" placeholder="请输入配件" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  import {getVehicles, listVehicles,addVehicles,updateVehicles,delVehicles,getVehiclesList} from "@/api/wx/vehicles";

  export default {
  name: "Vehicles",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 车辆信息表格数据
      vehiclesList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        carId: null,
        carNo: null,
        deviceNo: null,
        simNo: null,
        carTypeId: null,
        carTypeName: null,
        groupId: null,
        groupName: null,
        driverId: null,
        driverName: null,
        driverTel: null,
        engineNo: null,
        brand: null,
        colour: null,
        capacity: null,
        displacement: null,
        mileageRatio: null,
        fileNo: null,
        identityNo: null,
        registerDate: null,
        buyDate: null,
        annualReviewDate: null,
        certificatePic: null,
        pic: null,
        owner: null,
        custodian: null,
        buyAddress: null,
        remarks: null,
        useStatus: null,
        status: null,
        createdTime: null,
        parts: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      },
      //搜素关键字
      searchkeyword:''
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询车辆信息列表 */
    getList() {
      this.loading = true;
      // listVehicles(this.queryParams).then(response => {
      //   this.vehiclesList = response.rows;
      //   this.total = response.total;
      //   this.loading = false;
      // });
      getVehiclesList(this.searchkeyword).then(res=>{
        console.log('======listres======',res)
        if (res.data.code === 200){

          this.vehiclesList = res.data.data.dataList;

          console.log("=======vehiclelist========",this.vehiclesList)
          this.vehiclesList.forEach(item=>{
            addVehicles(JSON.stringify(item))
          })

          this.loading = false;
        }
      })
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        carId: null,
        carNo: null,
        deviceNo: null,
        simNo: null,
        carTypeId: null,
        carTypeName: null,
        groupId: null,
        groupName: null,
        driverId: null,
        driverName: null,
        driverTel: null,
        engineNo: null,
        brand: null,
        colour: null,
        capacity: null,
        displacement: null,
        mileageRatio: null,
        fileNo: null,
        identityNo: null,
        registerDate: null,
        buyDate: null,
        annualReviewDate: null,
        certificatePic: null,
        pic: null,
        owner: null,
        custodian: null,
        buyAddress: null,
        remarks: null,
        useStatus: "0",
        status: "0",
        createdTime: null,
        parts: null,
        updateTime: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.carId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加车辆信息";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const carId = row.carId || this.ids
      getVehicles(carId).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改车辆信息";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.carId != null) {
            updateVehicles(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addVehicles(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const carIds = row.carId || this.ids;
      this.$modal.confirm('是否确认删除车辆信息编号为"' + carIds + '"的数据项？').then(function() {
        return delVehicles(carIds);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('wx/vehicles/export', {
        ...this.queryParams
      }, `vehicles_${new Date().getTime()}.xlsx`)
    },
    toVehiclelog(carId){
      location.href = 'http://localhost:8555/info/vehiclelog?carNo='+carId
    },

  }
};
</script>
